package com.elective.courseselect.enums;/*
 *author limfff
 *date 2022/3/18
 */

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum UserType {

    SUPER_ADMIN(0,"超级管理员"),
    TEACHER(1,"老师"),
    STUDENT(2,"学生"),
    ORDINARY_ADMIN(3,"普通管理员")
    ;

    @EnumValue
    private final int code;
    private final String desc;

    public static UserType getByCode(Integer code){
        for (UserType value : values()) {
            if (code.equals(value.getCode())) {
                return value;
            }
        }
        return null;

    }
}

